#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std;

struct Item {
    int id;
    int value;
    int weight;
    double value_density; // 价值密度 = 价值 / 重量
};

// 比较函数：按价值密度降序排序（用于贪心计算上界）
bool compareByValueDensity(const Item &a, const Item &b) {
    return a.value_density > b.value_density;
}

// 回溯函数
void backtrack(const vector<Item>& items, int capacity, int current_value, int current_weight, 
               int level, int& max_value) {
    // 如果已经遍历完所有物品或者背包已满
    if (level == items.size() || current_weight == capacity) {
        if (current_value > max_value) {
            max_value = current_value;
        }
        return;
    }
    
    // 如果当前物品可以放入背包，尝试放入
    if (current_weight + items[level].weight <= capacity) {
        backtrack(items, capacity, 
                 current_value + items[level].value, 
                 current_weight + items[level].weight, 
                 level + 1, max_value);
    }
    
    // 不放入当前物品的情况
    backtrack(items, capacity, current_value, current_weight, level + 1, max_value);
}

int main(int argc, char* argv[]) {
    
    // 检查是否提供了文件路径参数
    if (argc < 2) {
        cerr << "Usage: " << argv[0] << " <filepath>" << endl;
        return 1;
    }
    
    string filepath = argv[1];  // 获取文件路径参数

    int n, capacity;
    cin >> n >> capacity;
    
    if(n > 100){
        cout << filepath << "," << -2 << endl;
        return 0;
    }

    vector<Item> items(n);
    for (int i = 0; i < n; ++i) {
        double value_double, weight_double;
        cin >> value_double >> weight_double;
        
        // 将浮点数转换为整数（四舍五入）
        int value = static_cast<int>(round(value_double));
        int weight = static_cast<int>(round(weight_double));
        
        // 检查除零情况
        double value_density = (weight > 0) ? static_cast<double>(value) / weight : 0.0;
        
        items[i] = {i + 1, value, weight, value_density};
    }

    // 按价值密度降序排序（优化搜索顺序）
    sort(items.begin(), items.end(), compareByValueDensity);

    int max_value = 0;
    
    // 调用回溯函数
    backtrack(items, capacity, 0, 0, 0, max_value);

    // 输出结果：filepath,max_value
    cout << filepath << "," << max_value << endl;

    return 0;
} 